package com.hnevc.liangxiangju;


import java.util.zip.DataFormatException;

public class Example01 {

    public static void main(String[] args) throws Exception {
        int result = 0;
        try {
            result = divide(4, -2);

        } catch (DataFormatException e) {
             System.out.println(e.getMessage());
        }
        System.out.println(result);

            System.out.println("我开始执行了");
}
    //实现两个整数相除
    public static  int divide(int x,int y) throws Exception{
        if (y<0) {
            throw  new  DivideByMinusException("除数为负数");
        }
        int result = x/y;
        return result;

    }
}
